function time() {
    var newtime = new Date();
    var hour = newtime.getHours();
    var min = newtime.getMinutes();
    var sec = newtime.getSeconds();
    var h = document.querySelector('main');
    if (hour < 10) {
        hour = "0" + hour;
    }
    if (min < 10) {
        min = "0" + min;
    }
    if (sec < 10) {
       sec = "0" + sec;
    }
    h.innerText = hour + ' 点 ' + min + ' 分 ' + sec + ' 秒 '
  
}
time();
setInterval(time,1000)